package cn.javabb.log.action;

import cn.javabb.common.model.ResponseModel;
import cn.javabb.core.entity.sys.LogDO;
import cn.javabb.log.action.base.BaseActionMap;
import cn.javabb.log.action.base.ResetLog;
import cn.javabb.log.action.model.OrderMethod;

/**
 * @desc:
 * @author: javabb (javabob(a)163.com)
 * @create: 2019/11/06 15:32
 */
public class OrderAction extends BaseActionMap {
    public final static String ORDER_CREATE = "create";
    @Override
    public void init() {
        // 记录数据保存日志
        putMethod(ORDER_CREATE,new OrderMethod("创建订单","createOrder"));
    }
    /**
     * 订单创建
     */
    public void createOrder(ResetLog resetLog){
        LogDO logDO = resetLog.getLog();
        ResponseModel response = (ResponseModel) resetLog.getRetValue();
        if (resetLog.isSuccess()){
            logDO.setMessage(String.format("创建订单成功,订单编号: [%s]",response.getData()));
        }else {
            logDO.setMessage(String.format("创建订单失败。"));
        }
    }
}
